import request from '@/utils/request'

// 获取工单统计
export const getCollectReport = (start, end) => {
  return request.get(`/api/task-service/task/taskReportInfo/${start}/${end}`)
}

// 获取工单状态列表
export const getTaskStatus = () => {
  return request.get('/api/task-service/task/allTaskStatus')
}

// 搜索工单
export const taskSearch = (params) => {
  return request.get('/api/task-service/task/search', {
    params
  })
}

// 获取工单类型列表
export const getTaskTypeList = (alertValue) => {
  return request.get('/api/task-service/taskType/list')
}

// 新增工单
export const createTask = (data) => {
  return request.post('/api/task-service/task/create', data)
}

// 获取补货预警值
export const getAlertValue = () => {
  return request.get('/api/task-service/task/supplyAlertValue')
}

// 设置补货预警值
export const setAlertValue = (data) => {
  return request.post('/api/task-service/task/autoSupplyConfig', data)
}

// 获取补货详情
export const getTaskDetails = (taskId) => {
  return request.get(`/api/task-service/taskDetails/${taskId}`)
}

// 获取工单信息
export const getTaskInfo = (taskId) => {
  return request.get(`/api/task-service/task/taskInfo/${taskId}`)
}

// 取消工单
export const cancelTask = (data) => {
  return request.post(`/api/task-service/task/cancel/${data.taskId}`, data)
}

// 获取设备维修次数
export const getRepairCount = (innerCode, start, end) => {
  return request.get(`/api/task-service/task/repairCount/${innerCode}/${start}/${end}`)
}

// 获取设备补货次数
export const getSupplyCount = (innerCode, start, end) => {
  return request.get(`/api/task-service/task/supplyCount/${innerCode}/${start}/${end}`)
}

// 获取工单统计信息
export const getTaskReportInfo = (start, end) => {
  return request.get(`/api/task-service/task/taskReportInfo/${start}/${end}`)
}

// 人效排名
export const getUserWorkTop10 = (start, end, isRepair, regionId) => {
  return request.get(`/api/task-service/task/userWorkTop10/${start}/${end}/${isRepair}/${regionId}`)
}
